home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2004 #2 / K-CD-2-2004.ISO / Fire Chief / data1.cab / Program_Executable_Files / Logic / tools / HPFunc.scp < prev    next >
Encoding:
Text File  |  2003-05-28  |  2.3 KB  |  136 lines

  1. s32     IniHPLink(mcString doorId, s32 nbLink, s32 idlink1,s32 idlink2,s32 idlink3,s32 idlink4 )
  2. {    
  3.     mcString recid;    
  4.     s32 linkindice;
  5.  
  6.     linkindice = 0;
  7.     recid = doorId + "_LINKID";
  8.  
  9.     SetVariable(doorId + "_NBLINK",nbLink);     
  10.  
  11.     if( (idlink1 != -1) && (linkindice < nbLink) )
  12.     {
  13.         AddVariable(recId + linkindice,idlink1); 
  14.         linkindice += 1;
  15.     }
  16.     else
  17.         return 0;        
  18.  
  19.     if( (idlink2 != -1 ) && (linkindice < nbLink) )
  20.     {
  21.         AddVariable(recId + linkindice,idlink2); 
  22.         linkindice += 1;
  23.     }        
  24.     else
  25.         return 0;        
  26.  
  27.     if( (idlink3 != -1 ) && (linkindice < nbLink) )
  28.     {
  29.         AddVariable(recId + linkindice ,idlink3); 
  30.         linkindice += 1;
  31.     }        
  32.     else
  33.         return 0;        
  34.  
  35.     if( (idlink4 != -1 ) && (linkindice < nbLink) )
  36.     {
  37.         AddVariable(recId + linkindice,idlink4); 
  38.         linkindice += 1;
  39.     }        
  40.     else
  41.         return 0;        
  42.  
  43.     return 0;
  44. }
  45.  
  46.  
  47. s32 CheckLink(mcString PorteName, s32 Id, s32 Sens)
  48. {
  49.     s32 nbLink;
  50.     s32 indice;
  51.     mcString doorid;
  52.     mcString linkid;
  53.  
  54.     doorid = PorteName + Id;
  55.     nbLink = GetVariable(doorid + "_NBLINK"); 
  56.  
  57.     if( nbLink != 0 )
  58.     {
  59.         linkid = doorid + "_LINKID";
  60.         for ( indice = 0; indice < nbLink; indice += 1 )
  61.         {
  62.             SetHotpointLinkActivated(GetVariable(linkid + indice)  ,Sens);            
  63.         }
  64.     }
  65.  
  66.     return 0;
  67. }
  68.  
  69. s32 CheckBigFire(s32 IDSource, s32 IDToCheck, f32 seuil)
  70. {
  71.     if( GetTimeSim() > 0 )
  72.     {
  73.         s32 SourceFireStarter;
  74.         s32 SeuilFeuGround;
  75.         f32 seuil_tot;
  76.         f32 CHP;
  77.         f32 MHP;
  78.         f32 CheckHP;
  79.  
  80.         SourceFireStarter    =    IsHotPointActivated(IDSource);
  81.     
  82.         if( SourceFireStarter == 1 )
  83.         {
  84.             CHP =    GetHotPointHP(IDSource);
  85.             MHP    =    GetHotPointMHP(IDSource);
  86.         
  87.             seuil_tot = MHP*seuil/100.0;
  88.  
  89.             if( CHP > seuil_tot )
  90.             {
  91.                 CheckHP = GetHotPointHP(IDToCheck);
  92.                 if( CheckHP <= 0.0 )
  93.                 {
  94.                     SetHotPointHP(IDToCheck,1.0);
  95.                     return 0;    
  96.                 }
  97.             }    
  98.  
  99.         } 
  100.     }
  101.  
  102.     return -1;
  103. }
  104.  
  105. s32 HPONOFF(mcString IdBase,s32 nbhp, s32 OnOff )
  106. {
  107.     s32 indice;
  108.     s32 id;
  109.  
  110.     for( indice = 0; indice < nbhp; indice +=1 )
  111.     {
  112.         id = GetVariable(IdBase + indice);        
  113.         SetHotpointActivated( id, OnOff);
  114.     }    
  115.  
  116.     return 0;
  117. }
  118.  
  119.  
  120. s32 TestHPstarted(mcString IdBase,s32 nbhp)
  121. {
  122.     s32 indice;
  123.     s32 id;
  124.  
  125.     for( indice = 0; indice < nbhp; indice +=1 )
  126.     {
  127.         id = GetVariable(IdBase + indice);        
  128.         if( GetHotpointHP(id) > 0.0 )
  129.             return 0;
  130.     }    
  131.  
  132.     return 1;
  133.  
  134. }
  135.  
  136.